namespace KPIS.GERP.Models.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class update0078 : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.ApprovePathSimulates",
                c => new
                    {
                        SimulateId = c.Guid(nullable: false, identity: true),
                        ApproverEmpId = c.Int(nullable: false),
                        SimulateStepNo = c.Int(nullable: false),
                        AppPathStepNo = c.Int(),
                        AppPathSubStepNo = c.Int(),
                        ApproverType = c.Int(nullable: false),
                        ApprovePathState = c.Int(nullable: false),
                        AppPathId = c.Int(nullable: false),
                        IsPassApproveLine = c.Boolean(nullable: false),
                        IsApproveAble = c.Boolean(nullable: false),
                        IsForwardable = c.Boolean(nullable: false),
                        IsRejectable = c.Boolean(nullable: false),
                        IsPendable = c.Boolean(nullable: false),
                        IsSendBackable = c.Boolean(nullable: false),
                        IsLockable = c.Boolean(nullable: false),
                        ApproverEmployee_EmpId = c.Int(),
                        Task_TaskId = c.Int(),
                    })
                .PrimaryKey(t => t.SimulateId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.ApproverEmployee_EmpId)
                .ForeignKey("dbo.SysApprovePath", t => t.AppPathId, cascadeDelete: true)
                .ForeignKey("dbo.SysTask", t => t.Task_TaskId)
                .Index(t => t.ApproverEmployee_EmpId)
                .Index(t => t.AppPathId)
                .Index(t => t.Task_TaskId);
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.ApprovePathSimulates", new[] { "Task_TaskId" });
            DropIndex("dbo.ApprovePathSimulates", new[] { "AppPathId" });
            DropIndex("dbo.ApprovePathSimulates", new[] { "ApproverEmployee_EmpId" });
            DropForeignKey("dbo.ApprovePathSimulates", "Task_TaskId", "dbo.SysTask");
            DropForeignKey("dbo.ApprovePathSimulates", "AppPathId", "dbo.SysApprovePath");
            DropForeignKey("dbo.ApprovePathSimulates", "ApproverEmployee_EmpId", "dbo.hrm_ps_employees");
            DropTable("dbo.ApprovePathSimulates");
        }
    }
}
